<!DOCTYPE html>
<html lang='en'>

<head>
    <meta charset='UTF-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>Document</title>
    <script src='../vue.global.js'></script>
</head>

<body>
    <div id='app'>

        <!-- 双分支 -->
        <h1 v-if="awesome">Vue is awesome!</h1>
        <h1 v-else>Oh no 😢</h1>
        <hr>

        <!-- 单分支 -->
        <!-- template这层标签不会渲染（幽灵标签） 代表内涵的DOM结构作为一个渲染的整体 -->
        <template v-if="ok">
            <h1>Title</h1>
            <p>Paragraph 1</p>
            <p>Paragraph 2</p>
        </template>
        <hr>

        
        <div v-if="Math.random() > 0.5">
            Now you see me
        </div>
        <div v-else>
            Now you don't
        </div>
        <hr>

        <!-- 多分支 -->
        <div v-if="type === 'A'">
            A
        </div>
        <div v-else-if="type === 'B'">
            B
        </div>
        <div v-else-if="type === 'C'">
            C
        </div>
        <div v-else>
            Not A/B/C
        </div>
    </div>

    <script>
        const app = Vue.createApp({
            data() {
                return {
                    awesome: null,
                    ok: false,
                    type:"C"
                }
            }
        })
        const vm = app.mount('#app')
    </script>
</body>

</html>